<template>
  <div>
    <page-header :isIndex="isIndex" />
    <router-view></router-view>
    <page-footer />
  </div>
</template>
 
<script>
import PageHeader from "../components/PageHeader.vue";
import PageFooter from "../components/PageFooter.vue";
export default {
  name: "Homepage",
  components: {
    PageHeader,
    PageFooter,
  },
  data() {
    return {
      isIndex: false,
    };
  },
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      console.log("to1:", to);
      vm.isIndex = to.name === "home" ? true : false;
    });
  },
  beforeRouteUpdate(to, from, next) {
    console.log("to2:", to);
    this.isIndex = to.name === "home" ? true : false;
    console.log(this.isIndex);
    next();
  },
};
</script>
<style lang="less" scoped>
</style>>
</style>